/*
 * @Author: IBOSS 2776641037@qq.com
 * @Date: 2024-11-07 11:28:12
 * @LastEditors: IBOSS 2776641037@qq.com
 * @LastEditTime: 2024-11-08 15:43:06
 * @Description:
 *
 * Copyright (c) 2024 by IBOSS, All Rights Reserved.
 */
import { requestClient } from '#/api/request';

export interface PageFetchParams {
  page: number;
  limit: number;

  [key: string]: any;
}

/**
 * 分页查询角色列表
 * @param params
 */
export async function getRolePageApi(params?: PageFetchParams) {
  return requestClient.get<string[]>(`/role`, { params });
}

/**
 * 获取角色详情
 * @param id
 */
export async function getRoleInfoApi(id: string) {
  return requestClient.get(`/role/${id}`);
}

/**
 * 添加角色
 * @param data
 */
export async function storeRoleApi(data: any) {
  return requestClient.post(`/role`, data);
}

/**
 * 编辑角色
 * @param id
 * @param data
 */
export async function updateRoleApi(id: string, data: any) {
  return requestClient.put(`/role/${id}`, data);
}

/**
 * 删除角色
 * @param id
 */
export async function deleteRoleApi(id: string) {
  return requestClient.delete(`/role/${id}`);
}

/**
 * 修改状态
 * @param id
 */
export async function setRoleStatusApi(id: string) {
  return requestClient.put(`/role/${id}/setStatus`);
}

/**
 * 获取角色列表
 */
export async function getRoleAllApi() {
  return requestClient.get('/role/getRoleAll');
}
